Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/github.com/aws/aws-s…
Browse files Browse the repository at this point in the history
…dk-go-v2/config-1.18.38
  • Loading branch information
chasefleming authored Sep 6, 2023
2 parents 7f5b06a + 3f74147 commit 52545df
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 12 deletions.
5 changes: 3 additions & 2 deletions access/grpc/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import (
"fmt"
"time"

"google.golang.org/protobuf/types/known/timestamppb"

"github.com/onflow/cadence"
jsoncdc "github.com/onflow/cadence/encoding/json"
"github.com/onflow/flow/protobuf/go/flow/access"
"github.com/onflow/flow/protobuf/go/flow/entities"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/crypto"
Expand Down Expand Up @@ -436,7 +437,7 @@ func messageToTransaction(m *entities.Transaction) (flow.Transaction, error) {

t.SetScript(m.GetScript())
t.SetReferenceBlockID(flow.HashToID(m.GetReferenceBlockId()))
t.SetGasLimit(m.GetGasLimit())
t.SetComputeLimit(m.GetGasLimit())

for _, arg := range m.GetArguments() {
t.AddRawArgument(arg)
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction_signing/multi_party/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func MultiPartySingleSignatureDemo() {
prepare(signer: AuthAccount) { log(signer.address) }
}
`)).
SetGasLimit(100).
SetComputeLimit(100).
SetProposalKey(account1.Address, account1.Keys[0].Index, account1.Keys[0].SequenceNumber).
SetReferenceBlockID(referenceBlockID).
SetPayer(account2.Address).
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction_signing/multi_party_multisig/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func MultiPartyMultiSignatureDemo() {
prepare(signer: AuthAccount) { log(signer.address) }
}
`)).
SetGasLimit(100).
SetComputeLimit(100).
SetProposalKey(account1.Address, account1.Keys[0].Index, account1.Keys[0].SequenceNumber).
SetReferenceBlockID(referenceBlockID).
SetPayer(account2.Address).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func MultiPartySingleSignatureDemo() {
log(signer2.address)
}
}`)).
SetGasLimit(100).
SetComputeLimit(100).
SetProposalKey(account1.Address, account1.Keys[0].Index, account1.Keys[0].SequenceNumber).
SetReferenceBlockID(referenceBlockID).
SetPayer(account2.Address).
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction_signing/single_party/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func SinglePartySingleSignatureDemo() {
prepare(signer: AuthAccount) { log(signer.address) }
}
`)).
SetGasLimit(100).
SetComputeLimit(100).
SetProposalKey(account1.Address, account1.Keys[0].Index, account1.Keys[0].SequenceNumber).
SetReferenceBlockID(referenceBlockID).
SetPayer(account1.Address).
Expand Down
2 changes: 1 addition & 1 deletion examples/transaction_signing/single_party_multisig/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func SinglePartyMultiSignatureDemo() {
prepare(signer: AuthAccount) { log(signer.address) }
}
`)).
SetGasLimit(100).
SetComputeLimit(100).
SetProposalKey(account1.Address, account1.Keys[0].Index, account1.Keys[0].SequenceNumber).
SetReferenceBlockID(referenceBlockID).
SetPayer(account1.Address).
Expand Down
2 changes: 1 addition & 1 deletion test/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (g *Transactions) NewUnsigned() *flow.Transaction {
tx := flow.NewTransaction().
SetScript(GreetingScript).
SetReferenceBlockID(blockID).
SetGasLimit(42).
SetComputeLimit(42).
SetProposalKey(accountA.Address, proposalKey.Index, proposalKey.SequenceNumber).
AddAuthorizer(accountA.Address).
SetPayer(accountB.Address)
Expand Down
9 changes: 9 additions & 0 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"sort"

"github.com/ethereum/go-ethereum/rlp"

"github.com/onflow/cadence"
jsoncdc "github.com/onflow/cadence/encoding/json"

Expand Down Expand Up @@ -183,11 +184,19 @@ func (t *Transaction) SetReferenceBlockID(blockID Identifier) *Transaction {
}

// SetGasLimit sets the gas limit for this transaction.
//
// Deprecated: Use SetComputationLimit Instead
func (t *Transaction) SetGasLimit(limit uint64) *Transaction {
t.GasLimit = limit
return t
}

// SetComputeLimit sets the compute limit for this transaction.
func (t *Transaction) SetComputeLimit(limit uint64) *Transaction {
t.GasLimit = limit
return t
}

// SetProposalKey sets the proposal key and sequence number for this transaction.
//
// The first two arguments specify the account key to be used, and the last argument is the sequence
Expand Down
8 changes: 4 additions & 4 deletions transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ExampleTransaction() {
tx := flow.NewTransaction().
SetScript([]byte(`transaction { execute { log("Hello, World!") } }`)).
SetReferenceBlockID(flow.Identifier{0x01, 0x02}).
SetGasLimit(42).
SetComputeLimit(42).
SetProposalKey(adrian.Address, adrianLaptopKey.Index, adrianLaptopKey.SequenceNumber).
SetPayer(blaine.Address).
AddAuthorizer(adrian.Address)
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestTransaction_SetGasLimit(t *testing.T) {
var gasLimit uint64 = 42

tx := flow.NewTransaction().
SetGasLimit(gasLimit)
SetComputeLimit(gasLimit)

assert.Equal(t, gasLimit, tx.GasLimit)
}
Expand Down Expand Up @@ -553,7 +553,7 @@ func baseTx() *flow.Transaction {
return flow.NewTransaction().
SetScript([]byte(`transaction { execute { log("Hello, World!") } }`)).
SetReferenceBlockID(flow.HexToID("f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b")).
SetGasLimit(42).
SetComputeLimit(42).
SetProposalKey(flow.HexToAddress("01"), 4, 10).
SetPayer(flow.HexToAddress("01")).
AddAuthorizer(flow.HexToAddress("01")).
Expand Down Expand Up @@ -614,7 +614,7 @@ func TestTransaction_RLPMessages(t *testing.T) {
},
{
name: "Zero gas limit",
tx: baseTx().SetGasLimit(0),
tx: baseTx().SetComputeLimit(0),
payload: "f872b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207dc0a0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b80880000000000000001040a880000000000000001c9880000000000000001",
envelope: "f899f872b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207dc0a0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b80880000000000000001040a880000000000000001c9880000000000000001e4e38004a0f7225388c1d69d57e6251c9fda50cbbf9e05131e5adb81e5aa0422402f048162",
},
Expand Down

0 comments on commit 52545df

Please sign in to comment.