fix wrong storage in genesis due to rlp changed behavior (EIP-2718)

This commit is contained in:
wanwiset25 2025-07-10 10:56:53 +07:00
parent 8e07f0678f
commit 069cd8ebce

View file

@ -41,7 +41,6 @@ import (
randomizeContract "github.com/XinFinOrg/XDPoSChain/contracts/randomize"
validatorContract "github.com/XinFinOrg/XDPoSChain/contracts/validator"
"github.com/XinFinOrg/XDPoSChain/crypto"
"github.com/XinFinOrg/XDPoSChain/rlp"
)
type GenesisInput struct {
@ -350,10 +349,7 @@ func (w *wizard) makeGenesis() {
code, _ := contractBackend.CodeAt(ctx, validatorAddress, nil)
storage := make(map[common.Hash]common.Hash)
f := func(key, val common.Hash) bool {
decode := []byte{}
trim := bytes.TrimLeft(val.Bytes(), "\x00")
rlp.DecodeBytes(trim, &decode)
storage[key] = common.BytesToHash(decode)
storage[key] = common.BytesToHash(val.Bytes())
log.Info("DecodeBytes", "value", val.String(), "decode", storage[key].String())
return true
}