-
Notifications
You must be signed in to change notification settings - Fork 140
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
Use upstream statedb #669
base: libevm
Are you sure you want to change the base?
Use upstream statedb #669
Conversation
@@ -258,11 +258,6 @@ func (g *Genesis) toBlock(db ethdb.Database, triedb *triedb.Database) *types.Blo | |||
for key, value := range account.Storage { | |||
statedb.SetState(addr, key, value) | |||
} | |||
if account.MCBalance != nil { |
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.
How are we now handling 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.
We're not, fuji and mainnet genesis don't use it so we will be getting rid of it for better alignment with upstream.
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.
Can we also get rid of
- GenesisMultiCoinBalance in gen_genesis_account and from account.go
- GetAssetBalance API
s.DumpToCollector(iterativeDump{output}, opts) | ||
} | ||
type ( | ||
// XXX: Handling IsMultiCoin / extras in dump |
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 does this comment mean? You use XXX
as a reminder, don't you?
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.
We could add support for properly dumping the extras in libevm or break api compatibility in that we just won't output IsMulticoin as I don't think anyone is really depending on it.
The XXX
is here for us to make a decision
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 can get rid of it.
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'm happy either way and already have it in ava-labs/libevm#49 pending what you guys decide.
@@ -515,15 +410,16 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error { | |||
checkeq("GetCode", state.GetCode(addr), checkstate.GetCode(addr)) | |||
checkeq("GetCodeHash", state.GetCodeHash(addr), checkstate.GetCodeHash(addr)) | |||
checkeq("GetCodeSize", state.GetCodeSize(addr), checkstate.GetCodeSize(addr)) | |||
// XXX: Can this be restored? |
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.
When and why was it commented out?
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's commented out since the forEachStorage
requires iterating on storage and we don't have that ability over the exported interfaces as far as I can tell.
@@ -1170,12 +838,16 @@ func TestGenerateMultiCoinAccounts(t *testing.T) { | |||
|
|||
// Get latest snapshot and make sure it has the correct account and storage | |||
snap := snaps.Snapshot(root) | |||
snapAccount, err := snap.Account(addrHash) | |||
snapAccount, err := snap.AccountRLP(addrHash) |
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.
Why decode the RLP manually instead of just using Account()
?
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.
Since there are no accessors for Extra on the SlimAccount, the only way to access it is to get the RLP and convert it to a full account (StateAccount) which we can call types.IsMuliCoin
on
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.
ava-labs/libevm#79 adds the accessor to SlimAccount
.
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.
Overall lgtm, I think we can get rid of few more multicoinbalance stuff.
s.DumpToCollector(iterativeDump{output}, opts) | ||
} | ||
type ( | ||
// XXX: Handling IsMultiCoin / extras in dump |
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 can get rid of it.
@@ -258,11 +258,6 @@ func (g *Genesis) toBlock(db ethdb.Database, triedb *triedb.Database) *types.Blo | |||
for key, value := range account.Storage { | |||
statedb.SetState(addr, key, value) | |||
} | |||
if account.MCBalance != nil { |
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.
Can we also get rid of
- GenesisMultiCoinBalance in gen_genesis_account and from account.go
- GetAssetBalance API
Uses upstream statedb
Import Path Updates:
github.com/ava-labs/coreth/trie
andgithub.com/ava-labs/coreth/triedb
togithub.com/ava-labs/libevm/trie
andgithub.com/ava-labs/libevm/triedb
in several files, deleting those packages.State Management:
GetLogData
to theStateDB
wrapper struct incore/extstate/statedb.go
, in preparation for using upstream StateDB.commitWithSnap
function to handle state commits with snapshot updates incore/blockchain.go
.writeBlockAndSetHead
andwriteBlockWithState
functions to includeparentRoot
as a parameter incore/blockchain.go
. [1] [2]core/genesis.go
. [1]Error Handling Improvements (already added in master):
TestWaitDeployedCornerCases
function inaccounts/abi/bind/util_test.go
.