-
Notifications
You must be signed in to change notification settings - Fork 11
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
Substate interface #939
Substate interface #939
Conversation
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.
Please provide unit test cases for each adapter (old_substate_account/substate_account).
Also, there are some methods in the interface definition that require unit tests (equal and stringify methods). Finally, can you make sure that the new interface does not impose a performance penalty (e.g. measure the runtime before and after your change for checking substate execution). Great job!
Env -> BlockEnvironment Result -> TransactionReceipt
930a63f
to
7e1f9ff
Compare
We have mixed uses of ethereum/common and substate/common type. I suggest that we have an independent module for common and types. This will be used by Aida and substate. ethereum/common will only be used in state/geth.go. This is an action item for future work. |
executor/transaction/substate_transaction/old_substate_account.go
Outdated
Show resolved
Hide resolved
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.
Regarding file names, since the file is under substate package. I suggest rename them to
substate_alloc.go -> world_state.go or substate_world_state.go
substate_env -> block_environment.go or substate_block_env.go
substate_result -> reciept.go or substate_reciept.go
executor/transaction/substate_transaction/old_substate_alloc.go
Outdated
Show resolved
Hide resolved
executor/transaction/substate_transaction/old_substate_result.go
Outdated
Show resolved
Hide resolved
executor/transaction/substate_transaction/old_substate_account.go
Outdated
Show resolved
Hide resolved
Renaming according to gh comments.
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.
Please check txcontact replace in comments. Some doesn't make sense.
InputValidationData -> InputState OutputValidationData -> OutputState
a27af1f
to
ff9dd19
Compare
executor/substate_processor.go
Outdated
getHash := func(num uint64) common.Hash { | ||
if inputEnv.BlockHashes == nil { | ||
*hashError = fmt.Errorf("getHash(%d) invoked, no blockhashes provided", num) | ||
return common.Hash{} | ||
} | ||
h, ok := inputEnv.BlockHashes[num] | ||
if !ok { | ||
*hashError = fmt.Errorf("getHash(%d) invoked, blockhash for that block not provided", num) | ||
} | ||
return h | ||
} |
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.
Note that this getHash function returns common.Hash{}
when Env.BlockHashes is nil
. The function inputEnv.GetBlockHash
doesn't seem to handle this.
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 have brought back the hash error
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.
Looks good! Let's do follow up items in later PRs.
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.
Please can you double-check your comments? You may have replaced strings too eagerly (transaction to tx / txcontext/ etc.). Also please add some comments to your unit tests.
Great!
Description
This PR creates
TransactionData
interface to unify the transaction like code.Any transaction execution-like data should implement this interface in order to unify the code and avoid code redundancy.
Before merging this PR:
go.mod
TODOs in separate PR:
#942 - Remove setters from the interfacedone#943 - Remove hard substate dependency
#944 - Use new SubstateDB
#945 - Change AidaDb type to
leveldb
#947 - Use execution data inside processor
Type of change