Skip to content

Commit

Permalink
chore: enable Iris protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jun 10, 2021
1 parent 2c42678 commit 26f720c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 21 deletions.
4 changes: 2 additions & 2 deletions aeternity/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ func (t *TxReceipt) Watch(mined chan bool, waitBlocks uint64, node transactionWa
}

func findVMABIVersion(nodeVersion string) (VMVersion, ABIVersion uint16, err error) {
if nodeVersion[0] == '5' {
return 5, 3, nil
if nodeVersion[0] == '6' {
return 7, 3, nil
}
return 0, 0, errors.New("node is unsupported")
}
6 changes: 3 additions & 3 deletions aeternity/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ func Test_findVMABIVersion(t *testing.T) {
wantErr bool
}{
{
name: "node version 5, FATE backend",
name: "node version 6, FATE backend",
args: args{
nodeVersion: "5",
nodeVersion: "6",
},
wantVMVersion: 5,
wantVMVersion: 7,
wantABIVersion: 3,
},
{
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ var Client = ClientConfig{
GasLimit: big.NewInt(1e6),
Amount: new(big.Int),
Deposit: new(big.Int),
VMVersion: 5,
VMVersion: 7,
ABIVersion: 3,
},
Oracles: OracleConfig{
Expand Down
2 changes: 1 addition & 1 deletion docker/aeternity_node_mean16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ chain:
persist: false
hard_forks:
"1": 0
"4": 1
"5": 1

mining:
autostart: true
Expand Down
4 changes: 2 additions & 2 deletions integration_test/compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func TestCompiler(t *testing.T) {
}
})
t.Run("DecodeCallResult", func(t *testing.T) {
// taken from contract_test.go running main(42) on identity.aes, GET /transactions/th_.../info
_, err := c.DecodeCallResult("ok", "cb_VNLOFXc=", "main", string(golden.Get(t, identitySource)))
// taken from contract_test.go running getArg(5) on identity.aes, GET /transactions/th_.../info
_, err := c.DecodeCallResult("ok", "cb_CpyCcgE=", "getArg", string(golden.Get(t, identitySource)))
if err != nil {
t.Error(err)
}
Expand Down
2 changes: 1 addition & 1 deletion integration_test/testdata/identity.aes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
contract Identity =
entrypoint main(z : int) = z
entrypoint getArg(z : int) = z
1 change: 1 addition & 0 deletions transactions/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TransactionTypes() map[uint]Transaction {
// RLP message version used in RLP serialization
const (
rlpMessageVersion uint = 1
rlpMessageVersion2 uint = 2
)

// Address-like bytearrays are converted in to an ID (uint8 bytearray) for RLP
Expand Down
12 changes: 1 addition & 11 deletions transactions/tx_ga.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ type GAMetaTx struct {
GasLimit *big.Int
GasPrice *big.Int
Fee *big.Int
TTL uint64
Tx *SignedTx
}

Expand All @@ -197,14 +196,13 @@ func (tx *GAMetaTx) EncodeRLP(w io.Writer) (err error) {

rlpRawMsg, err := buildRLPMessage(
ObjectTagGeneralizedAccountMetaTransaction,
rlpMessageVersion,
rlpMessageVersion2,
aID,
authDataBinary,
tx.AbiVersion,
tx.Fee,
tx.GasLimit,
tx.GasPrice,
tx.TTL,
txRLP,
)

Expand All @@ -227,7 +225,6 @@ type gaMetaRLP struct {
Fee *big.Int
GasLimit *big.Int
GasPrice *big.Int
TTL uint64
WrappedTx []byte
}

Expand Down Expand Up @@ -265,7 +262,6 @@ func (tx *GAMetaTx) DecodeRLP(s *rlp.Stream) (err error) {
tx.GasLimit = gtx.GasLimit
tx.GasPrice = gtx.GasPrice
tx.Fee = gtx.Fee
tx.TTL = gtx.TTL
tx.Tx = wtx.(*SignedTx)
return
}
Expand Down Expand Up @@ -295,19 +291,13 @@ func (tx *GAMetaTx) CalcGas() (g *big.Int, err error) {

// NewGAMetaTx creates a GAMetaTx
func NewGAMetaTx(accountID string, authData string, abiVersion uint16, gasLimit *big.Int, gasPrice *big.Int, wrappedTx Transaction, ttlnoncer TTLNoncer) (tx *GAMetaTx, err error) {
ttl, _, _, err := ttlnoncer(accountID, config.Client.TTL)
if err != nil {
return
}

tx = &GAMetaTx{
AccountID: accountID,
AuthData: authData,
AbiVersion: abiVersion,
GasLimit: gasLimit,
GasPrice: gasPrice,
Fee: config.Client.Fee,
TTL: ttl,
Tx: &SignedTx{
Signatures: [][]byte{},
Tx: wrappedTx,
Expand Down

0 comments on commit 26f720c

Please sign in to comment.