Type casting and function signature alterations needed to comply with plugeth-utils

This commit is contained in:
philip-morlier 2024-01-24 11:13:39 -08:00
parent 48be241dbf
commit 8722e19c77
3 changed files with 11 additions and 5 deletions

View File

@ -129,7 +129,7 @@ func (b *Backend) SendTx(ctx context.Context, signedTx []byte) error {
return b.b.SendTx(ctx, tx)
}
func (b *Backend) GetTransaction(ctx context.Context, txHash core.Hash) ([]byte, core.Hash, uint64, uint64, error) { // RLP Encoded transaction {
tx, blockHash, blockNumber, index, err := b.b.GetTransaction(ctx, common.Hash(txHash))
_, tx, blockHash, blockNumber, index, err := b.b.GetTransaction(ctx, common.Hash(txHash))
if err != nil {
return nil, core.Hash(blockHash), blockNumber, index, err
}

View File

@ -1,6 +1,8 @@
package backendwrapper
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/log"
@ -28,7 +30,7 @@ func (t *WrappedTrie) GetAccount(address core.Address) (*core.StateAccount, erro
}
return &core.StateAccount{
Nonce: act.Nonce,
Balance: act.Balance,
Balance: new(big.Int).SetBytes(act.Balance.Bytes()),
Root: core.Hash(act.Root),
CodeHash: act.CodeHash,
}, nil

View File

@ -4,6 +4,8 @@ import (
"math/big"
"encoding/json"
"github.com/holiman/uint256"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
@ -57,7 +59,7 @@ func (w *WrappedContract) Address() core.Address {
}
func (w *WrappedContract) Value() *big.Int {
return w.c.Value()
return new(big.Int).SetBytes(w.c.Value().Bytes())
}
func (w *WrappedContract) Input() []byte {
@ -128,7 +130,8 @@ func NewWrappedStateDB(d *state.StateDB) *WrappedStateDB {
// GetBalance(Address) *big.Int
func (w *WrappedStateDB) GetBalance(addr core.Address) *big.Int {
return w.s.GetBalance(common.Address(addr))
return new(big.Int).SetBytes(w.s.GetBalance(common.Address(addr)).Bytes())
}
// GetNonce(Address) uint64
@ -201,7 +204,8 @@ func (w *WrappedStateDB) IntermediateRoot(deleteEmptyObjects bool) core.Hash {
}
func (w *WrappedStateDB) AddBalance(addr core.Address, amount *big.Int) {
w.s.AddBalance(common.Address(addr), amount)
castAmount := new(uint256.Int)
w.s.AddBalance(common.Address(addr), castAmount.SetBytes(amount.Bytes()))
}
type Node struct {