Merge pull request #4510 from Frozen/hip30/testing-minor-fixes

Hip30/testing minor fixes.
pull/4514/head
Konstantin 1 year ago committed by GitHub
commit e20524267e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      core/genesis.go
  2. 3
      core/preimages.go
  3. 2
      core/state_processor.go
  4. 3
      internal/params/config.go

@ -253,17 +253,19 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
for key, value := range account.Storage {
statedb.SetState(addr, key, value)
}
//statedb.AddPreimage(crypto.Keccak256Hash((addr[:])), addr.Bytes()[:])
_ = rawdb.WritePreimages(
if err := rawdb.WritePreimages(
statedb.Database().DiskDB(), map[ethCommon.Hash][]byte{
crypto.Keccak256Hash(addr.Bytes()): addr.Bytes(),
},
)
); err != nil {
utils.Logger().Error().Err(err).Msg("Failed to store preimage")
os.Exit(1)
}
}
root := statedb.IntermediateRoot(false)
shardStateBytes, err := shard.EncodeWrapper(g.ShardState, false)
if err != nil {
utils.Logger().Error().Msg("failed to rlp-serialize genesis shard state")
utils.Logger().Error().Err(err).Msg("failed to rlp-serialize genesis shard state")
os.Exit(1)
}
head := g.Factory.NewHeader(common.Big0).With().

@ -31,7 +31,7 @@ func ImportPreimages(chain BlockChain, path string) error {
imported := uint64(0)
for {
record, err := csvReader.Read()
if err == io.EOF {
if errors.Is(err, io.EOF) {
return fmt.Errorf("MyBlockNumber field missing, cannot proceed")
}
if err != nil {
@ -166,7 +166,6 @@ func ExportPreimages(chain BlockChain, path string) error {
fmt.Sprintf("%x", asHash.Bytes()),
fmt.Sprintf("%x", address.Bytes()),
})
}
// lastly, write the block number
csvWriter.Write(

@ -310,7 +310,7 @@ func ApplyTransaction(bc ChainContext, author *common.Address, gp *GasPool, stat
// Apply the transaction to the current state (included in the env)
result, err := ApplyMessage(vmenv, msg, gp)
if err != nil {
return nil, nil, nil, 0, fmt.Errorf("apply failed from='%s' balance='%s' type='%s' value='%s': %w", msg.From().Hex(), statedb.GetBalance(msg.From()).String(), txType, tx.Value().String(), err)
return nil, nil, nil, 0, errors.Wrapf(err, "apply failed from='%s' to='%s' balance='%s'", msg.From().Hex(), msg.To().Hex(), statedb.GetBalance(msg.From()).String())
}
// Update the state with pending changes
var root []byte

@ -285,7 +285,7 @@ var (
LeaderRotationExternalBeaconLeaders: big.NewInt(6),
FeeCollectEpoch: big.NewInt(2),
ValidatorCodeFixEpoch: big.NewInt(2),
HIP30Epoch: big.NewInt(3),
HIP30Epoch: EpochTBD,
}
// AllProtocolChanges ...
@ -807,7 +807,6 @@ func (c *ChainConfig) IsHIP30(epoch *big.Int) bool {
// their balances over to shard 0 or 1.
func (c *ChainConfig) IsOneEpochBeforeHIP30(epoch *big.Int) bool {
return epoch.Sub(c.HIP30Epoch, epoch).Cmp(common.Big1) == 0
//return isForked(new(big.Int).Sub(c.HIP30Epoch, common.Big1), epoch)
}
// UpdateEthChainIDByShard update the ethChainID based on shard ID.

Loading…
Cancel
Save