Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into sovereign 29 ian #350

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/api/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ type AccountQueryOptions struct {
type BlockQueryOptions struct {
WithTransactions bool
WithLogs bool
ForHyperblock bool
}
8 changes: 8 additions & 0 deletions data/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,14 @@ type GuardedTransactionHandler interface {
GetDataForSigning(encoder Encoder, marshaller Marshaller, hasher Hasher) ([]byte, error)
}

// RelayedTransactionHandler defines functionality for the relayed transactions
type RelayedTransactionHandler interface {
GetRelayerAddr() []byte
GetRelayerSignature() []byte
GetSignature() []byte
GetDataForSigning(encoder Encoder, marshaller Marshaller, hasher Hasher) ([]byte, error)
}

// LogHandler defines the type for a log resulted from executing a transaction or smart contract call
type LogHandler interface {
// GetAddress returns the address of the sc that was originally called by the user
Expand Down
10 changes: 10 additions & 0 deletions data/outport/feeInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ func (f *FeeInfo) SetGasUsed(gasUsed uint64) {
func (f *FeeInfo) SetFee(fee *big.Int) {
f.Fee = fee
}

// SetGasRefunded sets the gas units refunded
func (f *FeeInfo) SetGasRefunded(gasRefunded uint64) {
f.GasRefunded = gasRefunded
}

// SetHadRefund sets hadRefund field with true
func (f *FeeInfo) SetHadRefund() {
f.HadRefund = true
}
334 changes: 211 additions & 123 deletions data/outport/outportBlock.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions data/outport/outportBlock.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ message FeeInfo {
uint64 GasUsed = 1 [(gogoproto.jsontag) = "gasUsed"];
bytes Fee = 2 [(gogoproto.jsontag) = "fee,omitempty", (gogoproto.casttypewith) = "math/big.Int;github.com/multiversx/mx-chain-core-go/data.BigIntCaster"];
bytes InitialPaidFee = 3 [(gogoproto.jsontag) = "initialPaidFee,omitempty", (gogoproto.casttypewith) = "math/big.Int;github.com/multiversx/mx-chain-core-go/data.BigIntCaster"];
uint64 GasRefunded = 4 [(gogoproto.jsontag) = "gasRefunded,omitempty"];
bool HadRefund = 5 [(gogoproto.jsontag) = "hadRefund,omitempty"];
}

message TxInfo {
Expand Down
1 change: 1 addition & 0 deletions data/transaction/apiTransactionResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type ApiTransactionResult struct {
IsRefund bool `json:"isRefund,omitempty"`
CallType string `json:"callType,omitempty"`
RelayerAddress string `json:"relayerAddress,omitempty"`
RelayerSignature string `json:"relayerSignature,omitempty"`
RelayedValue string `json:"relayedValue,omitempty"`
ChainID string `json:"chainID,omitempty"`
Version uint32 `json:"version,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions data/transaction/frontendTransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ type FrontendTransaction struct {
Options uint32 `json:"options,omitempty"`
GuardianAddr string `json:"guardian,omitempty"`
GuardianSignature string `json:"guardianSignature,omitempty"`
RelayerAddr string `json:"relayer,omitempty"`
RelayerSignature string `json:"relayerSignature,omitempty"`
}
9 changes: 9 additions & 0 deletions data/transaction/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ func (tx *Transaction) GetDataForSigning(encoder data.Encoder, marshaller data.M
ftx.GuardianAddr = guardianAddr
}

if len(tx.RelayerAddr) > 0 {
relayerAddr, errRelayer := encoder.Encode(tx.RelayerAddr)
if errRelayer != nil {
return nil, errRelayer
}

ftx.RelayerAddr = relayerAddr
}

ftxBytes, err := marshaller.Marshal(ftx)
if err != nil {
return nil, err
Expand Down
199 changes: 161 additions & 38 deletions data/transaction/transaction.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions data/transaction/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ message Transaction {
uint32 Options = 13 [(gogoproto.jsontag) = "options,omitempty"];
bytes GuardianAddr = 14 [(gogoproto.jsontag) = "guardian,omitempty"];
bytes GuardianSignature = 15 [(gogoproto.jsontag) = "guardianSignature,omitempty"];
bytes RelayerAddr = 16 [(gogoproto.jsontag) = "relayer,omitempty"];
bytes RelayerSignature = 17 [(gogoproto.jsontag) = "relayerSignature,omitempty"];
}