fixes for the IPA testnet

upgrade to latest go-verkle

update go-verkle to get more fixes

simplify code by removing all stateless references (#25)

fix verkle proof test by enforcing values alignment to 32 bytes

remove unneeded KZG tag

fix the stateless test

Move AccessWitness into StateDB (#27)

* move AccessWitness into StateDB

* set Accesses in TxContext constructor

* Ensures that a statedb is initialized with a witness

* copy AccessWitness in StateDB.Copy.  use copied state in miner worker.commit.

* remove redundant line

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>

Fix contract creation issue
This commit is contained in:
Guillaume Ballet
2021-11-04 20:45:43 +01:00
parent 719bf47354
commit 9f9c03a94c
12 changed files with 59 additions and 190 deletions

View File

@ -91,9 +91,6 @@ type environment struct {
header *types.Header
txs []*types.Transaction
receipts []*types.Receipt
// list of all locations touched by the transactions in this block
witness *types.AccessWitness
}
// task contains all information for consensus engine sealing and result submitting.
@ -699,7 +696,6 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
family: mapset.NewSet(),
uncles: mapset.NewSet(),
header: header,
witness: types.NewAccessWitness(),
}
// when 08 is processed ancestors contain 07 (quick block)
for _, ancestor := range w.chain.GetBlocksFromHash(parent.Hash(), 7) {
@ -849,10 +845,10 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
w.current.state.Prepare(tx.Hash(), w.current.tcount)
logs, accs, err := w.commitTransaction(tx, coinbase)
if w.current.witness == nil {
w.current.witness = accs
if w.current.state.Witness() == nil {
w.current.state.SetWitness(accs)
} else {
w.current.witness.Merge(accs)
w.current.state.Witness().Merge(accs)
}
switch {
case errors.Is(err, core.ErrGasLimitReached):
@ -1051,7 +1047,7 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st
if tr := s.GetTrie(); tr.IsVerkle() {
vtr := tr.(*trie.VerkleTrie)
// Generate the proof if we are using a verkle tree
p, err := vtr.ProveAndSerialize(w.current.witness.Keys(), w.current.witness.KeyVals())
p, err := vtr.ProveAndSerialize(s.Witness().Keys(), s.Witness().KeyVals())
w.current.header.VerkleProof = p
if err != nil {
return err