Skip to content

Commit 1469217

Browse files
TerryhungTerry
andauthored
feat: add more description for fevm models (#1231)
* add more description for fevm models --------- Co-authored-by: Terry <[email protected]>
1 parent 85d7f42 commit 1469217

File tree

5 files changed

+90
-56
lines changed

5 files changed

+90
-56
lines changed

model/fevm/blockheader.go

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,37 @@ type FEVMBlockHeader struct {
1414

1515
// Height message was executed at.
1616
Height int64 `pg:",pk,notnull,use_zero"`
17-
1817
// ETH Hash
1918
Hash string `pg:",notnull"`
20-
2119
// Parent Block ETH Hash
2220
ParentHash string `pg:",notnull"`
23-
21+
// ETH Address of the miner who mined this block.
2422
Miner string `pg:",notnull"`
25-
23+
// Block state root ETH hash.
2624
StateRoot string `pg:",notnull"`
27-
25+
// Set to a hardcoded value which is used by some clients to determine if has no transactions.
2826
TransactionsRoot string `pg:",notnull"`
29-
ReceiptsRoot string `pg:",notnull"`
30-
Difficulty uint64 `pg:",use_zero"`
31-
Number uint64 `pg:",use_zero"`
32-
GasLimit uint64 `pg:",use_zero"`
33-
GasUsed uint64 `pg:",use_zero"`
34-
Timestamp uint64 `pg:",use_zero"`
35-
ExtraData string `pg:",notnull"`
36-
MixHash string `pg:",notnull"`
37-
Nonce string `pg:",notnull"`
38-
BaseFeePerGas string `pg:",notnull"`
39-
Size uint64 `pg:",use_zero"`
40-
Sha3Uncles string `pg:",notnull"`
27+
// Hash of the transaction receipts trie.
28+
ReceiptsRoot string `pg:",notnull"`
29+
// ETH mining difficulty.
30+
Difficulty uint64 `pg:",use_zero"`
31+
// The number of the current block.
32+
Number uint64 `pg:",use_zero"`
33+
// Maximum gas allowed in this block.
34+
GasLimit uint64 `pg:",use_zero"`
35+
// The actual amount of gas used in this block.
36+
GasUsed uint64 `pg:",use_zero"`
37+
// The block time.
38+
Timestamp uint64 `pg:",use_zero"`
39+
// Arbitrary additional data as raw bytes.
40+
ExtraData string `pg:",notnull"`
41+
MixHash string `pg:",notnull"`
42+
Nonce string `pg:",notnull"`
43+
// The base fee value.
44+
BaseFeePerGas string `pg:",notnull"`
45+
// Block size.
46+
Size uint64 `pg:",use_zero"`
47+
Sha3Uncles string `pg:",notnull"`
4148
}
4249

4350
func (f *FEVMBlockHeader) Persist(ctx context.Context, s model.StorageBatch, version model.Version) error {

model/fevm/contract.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ type FEVMContract struct {
1414

1515
// Height message was executed at.
1616
Height int64 `pg:",pk,notnull,use_zero"`
17-
1817
// Actor address.
1918
ActorID string `pg:",notnull"`
20-
21-
// Actor Address in ETH
19+
// Actor Address in ETH.
2220
EthAddress string `pg:",notnull"`
23-
24-
ByteCode string `pg:",notnull"`
21+
// Contract Bytecode.
22+
ByteCode string `pg:",notnull"`
23+
// Contract Bytecode is encoded in hash by Keccak256.
2524
ByteCodeHash string `pg:",notnull"`
26-
25+
// Balance of EVM actor in attoFIL.
2726
Balance string `pg:"type:numeric,notnull"`
28-
Nonce uint64 `pg:",use_zero"`
27+
// The next actor nonce that is expected to appear on chain.
28+
Nonce uint64 `pg:",use_zero"`
2929
}
3030

3131
func (f *FEVMContract) Persist(ctx context.Context, s model.StorageBatch, version model.Version) error {

model/fevm/receipt.go

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,34 @@ type FEVMReceipt struct {
1414

1515
// Height message was executed at.
1616
Height int64 `pg:",pk,notnull,use_zero"`
17-
1817
// Message CID
1918
Message string `pg:",use_zero"`
20-
21-
TransactionHash string `pg:",notnull"`
22-
TransactionIndex uint64 `pg:",use_zero"`
23-
BlockHash string `pg:",notnull"`
24-
BlockNumber uint64 `pg:",use_zero"`
25-
From string `pg:",notnull"`
26-
To string `pg:",notnull"`
27-
ContractAddress string `pg:",notnull"`
28-
Status uint64 `pg:",use_zero"`
19+
// Hash of transaction.
20+
TransactionHash string `pg:",notnull"`
21+
// Integer of the transactions index position in the block.
22+
TransactionIndex uint64 `pg:",use_zero"`
23+
// Hash of the block where this transaction was in.
24+
BlockHash string `pg:",notnull"`
25+
// Block number where this transaction was in.
26+
BlockNumber uint64 `pg:",use_zero"`
27+
// ETH Address of the sender.
28+
From string `pg:",notnull"`
29+
// ETH Address of the receiver.
30+
To string `pg:",notnull"`
31+
// The contract address created, if the transaction was a contract creation, otherwise null.
32+
ContractAddress string `pg:",notnull"`
33+
// 0 indicates transaction failure , 1 indicates transaction succeeded.
34+
Status uint64 `pg:",use_zero"`
35+
// The total amount of gas used when this transaction was executed in the block.
2936
CumulativeGasUsed uint64 `pg:",use_zero"`
30-
GasUsed uint64 `pg:",use_zero"`
31-
EffectiveGasPrice int64 `pg:",use_zero"`
32-
LogsBloom string `pg:",notnull"`
33-
Logs string `pg:",type:jsonb"`
37+
// The actual amount of gas used in this block.
38+
GasUsed uint64 `pg:",use_zero"`
39+
// The actual value per gas deducted from the senders account.
40+
EffectiveGasPrice int64 `pg:",use_zero"`
41+
// Includes the bloom filter representation of the logs
42+
LogsBloom string `pg:",notnull"`
43+
// Array of log objects, which this transaction generated.
44+
Logs string `pg:",type:jsonb"`
3445
}
3546

3647
func (f *FEVMReceipt) Persist(ctx context.Context, s model.StorageBatch, version model.Version) error {

model/fevm/trace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type FEVMTrace struct {
3636
Value string `pg:"type:numeric,notnull"`
3737
// Method called on To (receiver).
3838
Method uint64 `pg:",notnull,use_zero"`
39-
// Params contained in message encode in eth bytes.
39+
// Method in readable name.
4040
ParsedMethod string `pg:",notnull"`
4141
// ActorCode of To (receiver).
4242
ActorCode string `pg:",notnull"`

model/fevm/transaction.go

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,41 @@ type FEVMTransaction struct {
1414

1515
// Height message was executed at.
1616
Height int64 `pg:",pk,notnull,use_zero"`
17-
18-
Hash string `pg:",pk,notnull"`
19-
ChainID uint64 `pg:",use_zero"`
20-
Nonce uint64 `pg:",use_zero"`
21-
BlockHash string `pg:",notnull"`
22-
BlockNumber uint64 `pg:",use_zero"`
23-
TransactionIndex uint64 `pg:",use_zero"`
24-
From string `pg:",notnull"`
25-
To string `pg:",notnull"`
26-
Value string `pg:",notnull"`
27-
Type uint64 `pg:",use_zero"`
28-
Input string `pg:",notnull"`
29-
Gas uint64 `pg:",use_zero"`
30-
MaxFeePerGas string `pg:"type:numeric,notnull"`
17+
// Hash of transaction.
18+
Hash string `pg:",pk,notnull"`
19+
// EVM network id.
20+
ChainID uint64 `pg:",use_zero"`
21+
// A sequentially incrementing counter which indicates the transaction number from the account.
22+
Nonce uint64 `pg:",use_zero"`
23+
// Hash of the block where this transaction was in.
24+
BlockHash string `pg:",notnull"`
25+
// Block number where this transaction was in.
26+
BlockNumber uint64 `pg:",use_zero"`
27+
// Integer of the transactions index position in the block.
28+
TransactionIndex uint64 `pg:",use_zero"`
29+
// ETH Address of the sender.
30+
From string `pg:",notnull"`
31+
// ETH Address of the receiver.
32+
To string `pg:",notnull"`
33+
// Amount of FIL to transfer from sender to recipient.
34+
Value string `pg:",notnull"`
35+
// Type of transactions.
36+
Type uint64 `pg:",use_zero"`
37+
// The data sent along with the transaction.
38+
Input string `pg:",notnull"`
39+
// Gas provided by the sender.
40+
Gas uint64 `pg:",use_zero"`
41+
// The maximum fee per unit of gas willing to be paid for the transaction.
42+
MaxFeePerGas string `pg:"type:numeric,notnull"`
43+
// The maximum price of the consumed gas to be included as a tip to the validator.
3144
MaxPriorityFeePerGas string `pg:"type:numeric,notnull"`
3245
AccessList string `pg:",type:jsonb"`
33-
V string `pg:",notnull"`
34-
R string `pg:",notnull"`
35-
S string `pg:",notnull"`
46+
// Transaction’s signature. Recovery Identifier.
47+
V string `pg:",notnull"`
48+
// Transaction’s signature. Outputs of an ECDSA signature.
49+
R string `pg:",notnull"`
50+
// Transaction’s signature. Outputs of an ECDSA signature.
51+
S string `pg:",notnull"`
3652
}
3753

3854
func (f *FEVMTransaction) Persist(ctx context.Context, s model.StorageBatch, version model.Version) error {

0 commit comments

Comments
 (0)