New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP-2935 #6991
EIP-2935 #6991
Conversation
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, the requested changes are naming and contract addresses.
evm/src/main/java/org/hyperledger/besu/evm/operation/BlockHashOperation.java
Outdated
Show resolved
Hide resolved
...m/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/HistoricalBlockHashProcessor.java
Outdated
Show resolved
Hide resolved
...m/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/HistoricalBlockHashProcessor.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
...m/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/HistoricalBlockHashProcessor.java
Show resolved
Hide resolved
...m/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/HistoricalBlockHashProcessor.java
Outdated
Show resolved
Hide resolved
storeParentHash(account, currentBlockHeader); | ||
|
||
BlockHeader ancestor = | ||
blockchain.getBlockHeader(currentBlockHeader.getParentHash()).orElseThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if an exception is thrown due to not finding a parent hash? Will Besu crash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, should likely just replace this with a presence check, and no-op if it is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally it's not possible to try import a block without having the parent it will be a critical issue. maybe we need to test to be sure the behavior is correct in this case and be sure we are considering the block as problematic to allow a retry ?
...reum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClearEmptyAccountStrategy.java
Show resolved
Hide resolved
frame | ||
.getWorldUpdater() | ||
.get(HISTORY_STORAGE_ADDRESS) | ||
.getStorageValue(UInt256.valueOf(soughtBlock % BLOCKHASH_OLD_WINDOW))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be doing soughtBlock % HISTORY_SERVE_WINDOW
not soughtBlock % BLOCKHASH_OLD_WINDOW
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think jason is right here, we may need to add a test where the block being sought is > BLOCKHASH_OLD_WINDOW but < HISTORY_SERVE_WINDOW
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last information I had was that this EIP was not supposed to serve more than 256 block hashes with the block hash operation, but this may have changed and needs to be verified. @Gabriel-Trintinalia
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKHASH_OLD_WINDOW
is the serving window pre-prague. HISTORY_SERVE_WINDOW
is the new serving window. There was an error in that part. Fixed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be fine for me as it's similar to the verkle implementation that is currently working in a devnet.
We just need to be sure we are catching correctly the case where we don't have the parent header and try this feature with reference tests when it will be available
and check the block hash operation implementation
...reum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClearEmptyAccountStrategy.java
Show resolved
Hide resolved
storeParentHash(account, currentBlockHeader); | ||
|
||
BlockHeader ancestor = | ||
blockchain.getBlockHeader(currentBlockHeader.getParentHash()).orElseThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally it's not possible to try import a block without having the parent it will be a critical issue. maybe we need to test to be sure the behavior is correct in this case and be sure we are considering the block as problematic to allow a retry ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with jasons comments
storeParentHash(account, currentBlockHeader); | ||
|
||
BlockHeader ancestor = | ||
blockchain.getBlockHeader(currentBlockHeader.getParentHash()).orElseThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, should likely just replace this with a presence check, and no-op if it is missing
frame | ||
.getWorldUpdater() | ||
.get(HISTORY_STORAGE_ADDRESS) | ||
.getStorageValue(UInt256.valueOf(soughtBlock % BLOCKHASH_OLD_WINDOW))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think jason is right here, we may need to add a test where the block being sought is > BLOCKHASH_OLD_WINDOW but < HISTORY_SERVE_WINDOW
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
...m/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/HistoricalBlockHashProcessor.java
Show resolved
Hide resolved
evm/src/main/java/org/hyperledger/besu/evm/operation/BlockHashOperation.java
Show resolved
Hide resolved
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EVM implementation will cause problems with downstream users of the library. It should be refactored so the logic remains within the Block Hash Lookup function passed into the EVM, rather than bleeding into block hash operation logic. This is why the function was created.
@@ -29,45 +32,105 @@ | |||
/** The Block hash operation. */ | |||
public class BlockHashOperation extends AbstractFixedCostOperation { | |||
|
|||
private static final int MAX_RELATIVE_BLOCK = 255; | |||
/** The HISTORY_STORAGE_ADDRESS */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this implementation, as it forces design decisions onto downstream users of the library.
This logic should live in a new BlockHashLookup function that is wired in in the mainnet protocol schedule, rather than re-writing the operation based on a flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a WIP of how I think it should work - main...shemnon:besu:eip-2935-danno
- Move all block hash lookup out of the operation, the operation only delegates to the data rpovider
- the data provider is part of the protocol spec
- merge in the beacon and block hash processing into the same class
- MainnetProtocolSpecs is where it all gets loaded in.
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Changes are needed, it damages the utility of the standalone EVM library. Here's my WIP to retain this utility - main...shemnon:besu:eip-2935-danno |
Here's a more fully worked version: #7080 |
PR #7080 is ready to review. It includes the changes in this PR but also containing the changes the EVM needs to remain a standalone library. @Gabriel-Trintinalia |
Closed in favour of #7080 |
PR description
fix #6531