Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
address review
Browse files Browse the repository at this point in the history
aarshkshah1992 committed Jul 10, 2024

Unverified

No user is associated with the committer email.
1 parent acf7db6 commit 4754e7c
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 13 additions & 5 deletions chain/types/ethtypes/eth_types.go
Original file line number Diff line number Diff line change
@@ -203,18 +203,26 @@ func init() {
}
}

func NewEthBlock(hasTransactions bool, tipsetLen int) EthBlock {
// make a copy of FullEthBloom
LogsBloom := make([]byte, len(FullEthBloom))
copy(LogsBloom, FullEthBloom[:])
func NewEmptyEthBloom() []byte {
b := make([]byte, len(EmptyEthBloom))
copy(b, EmptyEthBloom[:])
return b
}

func NewFullEthBloom() []byte {
b := make([]byte, len(FullEthBloom))
copy(b, FullEthBloom[:])
return b
}

func NewEthBlock(hasTransactions bool, tipsetLen int) EthBlock {
b := EthBlock{
Sha3Uncles: EmptyUncleHash, // Sha3Uncles set to a hardcoded value which is used by some clients to determine if has no uncles.
StateRoot: EmptyEthHash,
TransactionsRoot: EmptyRootHash, // TransactionsRoot set to a hardcoded value which is used by some clients to determine if has no transactions.
ReceiptsRoot: EmptyEthHash,
Difficulty: EmptyEthInt,
LogsBloom: LogsBloom,
LogsBloom: NewFullEthBloom(),
Extradata: []byte{},
MixHash: EmptyEthHash,
Nonce: EmptyEthNonce,
4 changes: 1 addition & 3 deletions node/impl/full/eth_utils.go
Original file line number Diff line number Diff line change
@@ -690,8 +690,6 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
if tx.BlockNumber != nil {
blockNumber = *tx.BlockNumber
}
LogsBloom := make([]byte, len(ethtypes.EmptyEthBloom))
copy(LogsBloom, ethtypes.EmptyEthBloom[:])

receipt := api.EthTxReceipt{
TransactionHash: tx.Hash,
@@ -702,7 +700,7 @@ func newEthTxReceipt(ctx context.Context, tx ethtypes.EthTx, lookup *api.MsgLook
BlockNumber: blockNumber,
Type: ethtypes.EthUint64(2),
Logs: []ethtypes.EthLog{}, // empty log array is compulsory when no logs, or libraries like ethers.js break
LogsBloom: LogsBloom,
LogsBloom: ethtypes.NewEmptyEthBloom(),
}

if lookup.Receipt.ExitCode.IsSuccess() {

0 comments on commit 4754e7c

Please sign in to comment.