diff --git a/client-sdk/go/modules/consensusaccounts/consensus_accounts.go b/client-sdk/go/modules/consensusaccounts/consensus_accounts.go index 8cb85805a5..11bd1cda57 100644 --- a/client-sdk/go/modules/consensusaccounts/consensus_accounts.go +++ b/client-sdk/go/modules/consensusaccounts/consensus_accounts.go @@ -42,7 +42,7 @@ func (a *v1) Deposit(ctx context.Context, signer signature.Signer, nonce uint64, } tx := types.NewTransaction(nil, methodDeposit, deposit) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: signer.Public()}}, nonce) stx := tx.PrepareForSigning() if err = stx.AppendSign(info.ChainContext, signer); err != nil { return err @@ -63,7 +63,7 @@ func (a *v1) Withdraw(ctx context.Context, signer signature.Signer, nonce uint64 } tx := types.NewTransaction(nil, methodWithdraw, withdraw) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: signer.Public()}}, nonce) stx := tx.PrepareForSigning() if err = stx.AppendSign(info.ChainContext, signer); err != nil { return err diff --git a/client-sdk/go/types/transaction.go b/client-sdk/go/types/transaction.go index 04f610dd49..a1677789e1 100644 --- a/client-sdk/go/types/transaction.go +++ b/client-sdk/go/types/transaction.go @@ -17,8 +17,8 @@ var SignatureContextBase = []byte("oasis-runtime-sdk/tx: v0") const LatestTransactionVersion = 1 type AuthProof struct { - Solo []byte `json:"solo,omitempty"` - Multisig [][]byte `json:"multisig,omitempty"` + Signature []byte `json:"signature,omitempty"` + Multisig [][]byte `json:"multisig,omitempty"` } // UnverifiedTransaction is an unverified transaction. @@ -83,8 +83,8 @@ func (ts *TransactionSigner) AppendSign(ctx signature.Context, signer signature. any := false for i, si := range ts.tx.AuthInfo.SignerInfo { switch { - case si.AddressSpec.Solo != nil: - if !si.AddressSpec.Solo.Equal(pk) { + case si.AddressSpec.Signature != nil: + if !si.AddressSpec.Signature.Equal(pk) { continue } @@ -96,7 +96,7 @@ func (ts *TransactionSigner) AppendSign(ctx signature.Context, signer signature. if err != nil { return fmt.Errorf("signer info %d: failed to sign transaction: %w", i, err) } - ts.ut.AuthProofs[i].Solo = sig + ts.ut.AuthProofs[i].Signature = sig case si.AddressSpec.Multisig != nil: for j, mss := range si.AddressSpec.Multisig.Signers { if !mss.PublicKey.Equal(pk) { @@ -204,14 +204,14 @@ type Fee struct { } type AddressSpec struct { - Solo *PublicKey `json:"solo,omitempty"` - Multisig *MultisigConfig `json:"multisig,omitempty"` + Signature *PublicKey `json:"signature,omitempty"` + Multisig *MultisigConfig `json:"multisig,omitempty"` } func (as *AddressSpec) Address() (Address, error) { switch { - case as.Solo != nil: - return NewAddress(as.Solo), nil + case as.Signature != nil: + return NewAddress(as.Signature), nil case as.Multisig != nil: return NewAddressFromMultisig(as.Multisig), nil default: @@ -221,8 +221,8 @@ func (as *AddressSpec) Address() (Address, error) { func (as *AddressSpec) Batch(ap AuthProof) ([]PublicKey, [][]byte, error) { switch { - case as.Solo != nil && ap.Solo != nil: - return []PublicKey{*as.Solo}, [][]byte{ap.Solo}, nil + case as.Signature != nil && ap.Signature != nil: + return []PublicKey{*as.Signature}, [][]byte{ap.Signature}, nil case as.Multisig != nil && ap.Multisig != nil: return as.Multisig.Batch(ap.Multisig) default: diff --git a/client-sdk/go/types/transaction_test.go b/client-sdk/go/types/transaction_test.go index 796643439c..d42dc015f4 100644 --- a/client-sdk/go/types/transaction_test.go +++ b/client-sdk/go/types/transaction_test.go @@ -47,8 +47,8 @@ func TestTransactionSigning(t *testing.T) { signer2 := ed25519.WrapSigner(memorySigner.NewTestSigner("oasis-runtime-sdk/test-keys: tx signing 2")) tx := NewTransaction(nil, "hello.World", nil) - tx.AppendSignerInfo(AddressSpec{Solo: &PublicKey{PublicKey: signer.Public()}}, 42) - tx.AppendSignerInfo(AddressSpec{Solo: &PublicKey{PublicKey: signer2.Public()}}, 43) + tx.AppendSignerInfo(AddressSpec{Signature: &PublicKey{PublicKey: signer.Public()}}, 42) + tx.AppendSignerInfo(AddressSpec{Signature: &PublicKey{PublicKey: signer2.Public()}}, 43) tx.AppendSignerInfo(AddressSpec{Multisig: &MultisigConfig{ Signers: []MultisigSigner{ {PublicKey: PublicKey{PublicKey: signer.Public()}, Weight: 1}, diff --git a/client-sdk/ts-web/rt/playground/src/consensus.js b/client-sdk/ts-web/rt/playground/src/consensus.js index a963e3aa1b..fd5ca40664 100644 --- a/client-sdk/ts-web/rt/playground/src/consensus.js +++ b/client-sdk/ts-web/rt/playground/src/consensus.js @@ -62,7 +62,7 @@ export const playground = (async function () { }) .query(nic); const siAlice1 = /** @type {oasisRT.types.SignerInfo} */ ({ - address_spec: {solo: {ed25519: csAlice.public()}}, + address_spec: {signature: {ed25519: csAlice.public()}}, nonce: nonce1, }); @@ -93,7 +93,7 @@ export const playground = (async function () { }) .query(nic); const siAlice2 = /** @type {oasisRT.types.SignerInfo} */ ({ - address_spec: {solo: {ed25519: csAlice.public()}}, + address_spec: {signature: {ed25519: csAlice.public()}}, nonce: nonce2, }); const WITHDRAW_AMNT = /** @type {oasisRT.types.BaseUnits} */ ([ diff --git a/client-sdk/ts-web/rt/playground/src/index.js b/client-sdk/ts-web/rt/playground/src/index.js index 588b021dcc..ef3aae9ddf 100644 --- a/client-sdk/ts-web/rt/playground/src/index.js +++ b/client-sdk/ts-web/rt/playground/src/index.js @@ -162,7 +162,7 @@ export const playground = (async function () { }) .query(nic); const siAlice1 = /** @type {oasisRT.types.SignerInfo} */ ({ - address_spec: {solo: {ed25519: csAlice.public()}}, + address_spec: {signature: {ed25519: csAlice.public()}}, nonce: nonce1, }); @@ -204,7 +204,7 @@ export const playground = (async function () { }) .query(nic); const siAlice2 = /** @type {oasisRT.types.SignerInfo} */ ({ - address_spec: {solo: {ed25519: csAlice.public()}}, + address_spec: {signature: {ed25519: csAlice.public()}}, nonce: nonce2, }); diff --git a/client-sdk/ts-web/rt/src/transaction.ts b/client-sdk/ts-web/rt/src/transaction.ts index 74473a8fd1..bfe405706e 100644 --- a/client-sdk/ts-web/rt/src/transaction.ts +++ b/client-sdk/ts-web/rt/src/transaction.ts @@ -40,13 +40,13 @@ export async function signAny( } } -export async function proveSolo( +export async function proveSignature( pk: types.PublicKey, signer: AnySigner, context: string, body: Uint8Array, ) { - return {solo: await signAny(pk, signer, context, body)}; + return {signature: await signAny(pk, signer, context, body)}; } export async function proveMultisig( @@ -77,8 +77,13 @@ export async function proveAny( context: string, body: Uint8Array, ) { - if ('solo' in addressSpec) { - return await proveSolo(addressSpec.solo, proofProvider as AnySigner, context, body); + if ('signature' in addressSpec) { + return await proveSignature( + addressSpec.signature, + proofProvider as AnySigner, + context, + body, + ); } else if ('multisig' in addressSpec) { return await proveMultisig( addressSpec.multisig, diff --git a/client-sdk/ts-web/rt/src/types.ts b/client-sdk/ts-web/rt/src/types.ts index 49b18a2fca..286ef0f111 100644 --- a/client-sdk/ts-web/rt/src/types.ts +++ b/client-sdk/ts-web/rt/src/types.ts @@ -74,7 +74,7 @@ export interface RewardsRewardStep { * Common information that specifies an address as well as how to authenticate. */ export interface AddressSpec { - solo?: PublicKey; + signature?: PublicKey; multisig?: MultisigConfig; } @@ -87,7 +87,7 @@ export interface AuthInfo { } export interface AuthProof { - solo?: Uint8Array; + signature?: Uint8Array; multisig?: Uint8Array[]; } diff --git a/runtime-sdk/src/modules/consensus/mod.rs b/runtime-sdk/src/modules/consensus/mod.rs index 45ac40f354..6b47c926b6 100644 --- a/runtime-sdk/src/modules/consensus/mod.rs +++ b/runtime-sdk/src/modules/consensus/mod.rs @@ -244,7 +244,7 @@ impl API for Module { .signer_info[0] .address_spec { - AddressSpec::Solo(PublicKey::Ed25519(_)) => Ok(()), + AddressSpec::Signature(PublicKey::Ed25519(_)) => Ok(()), _ => Err(Error::ConsensusIncompatibleSigner), } } diff --git a/runtime-sdk/src/types/transaction.rs b/runtime-sdk/src/types/transaction.rs index f862c267be..84de99b237 100644 --- a/runtime-sdk/src/types/transaction.rs +++ b/runtime-sdk/src/types/transaction.rs @@ -28,8 +28,8 @@ pub enum Error { #[derive(Clone, Debug, Serialize, Deserialize)] pub enum AuthProof { - #[serde(rename = "solo")] - Solo(Signature), + #[serde(rename = "signature")] + Signature(Signature), #[serde(rename = "multisig")] Multisig(multisig::SignatureSetOwned), } @@ -131,8 +131,8 @@ pub struct Fee { /// Common information that specifies an address as well as how to authenticate. #[derive(Clone, Debug, Serialize, Deserialize)] pub enum AddressSpec { - #[serde(rename = "solo")] - Solo(PublicKey), + #[serde(rename = "signature")] + Signature(PublicKey), #[serde(rename = "multisig")] Multisig(multisig::Config), } @@ -140,14 +140,14 @@ pub enum AddressSpec { impl AddressSpec { pub fn address(&self) -> Address { match self { - AddressSpec::Solo(public_key) => Address::from_pk(public_key), + AddressSpec::Signature(public_key) => Address::from_pk(public_key), AddressSpec::Multisig(config) => Address::from_multisig(config), } } pub fn batch(&self, auth_proof: &AuthProof) -> Result<(Vec, Vec), Error> { Ok(match (self, auth_proof) { - (AddressSpec::Solo(public_key), AuthProof::Solo(signature)) => { + (AddressSpec::Signature(public_key), AuthProof::Signature(signature)) => { (vec![public_key.clone()], vec![signature.clone()]) } (AddressSpec::Multisig(config), AuthProof::Multisig(signature_set)) => config @@ -173,7 +173,7 @@ impl SignerInfo { /// Create a new signer info from public key and nonce. pub fn new(public_key: PublicKey, nonce: u64) -> Self { Self { - address_spec: AddressSpec::Solo(public_key), + address_spec: AddressSpec::Signature(public_key), nonce, } } diff --git a/tests/e2e/simplekvtest.go b/tests/e2e/simplekvtest.go index 78c0cf856f..4547043581 100644 --- a/tests/e2e/simplekvtest.go +++ b/tests/e2e/simplekvtest.go @@ -81,7 +81,7 @@ func kvInsert(rtc client.RuntimeClient, signer signature.Signer, key []byte, val Key: key, Value: value, }) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: signer.Public()}}, nonce) stx := tx.PrepareForSigning() stx.AppendSign(chainCtx, signer) @@ -109,7 +109,7 @@ func kvRemove(rtc client.RuntimeClient, signer signature.Signer, key []byte) err }, "keyvalue.Remove", kvKey{ Key: key, }) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: signer.Public()}}, nonce) stx := tx.PrepareForSigning() stx.AppendSign(chainCtx, signer) @@ -370,7 +370,7 @@ func KVTransferTest(log *logging.Logger, conn *grpc.ClientConn, rtc client.Runti To: testing.Bob.Address, Amount: types.NewBaseUnits(*quantity.NewFromUint64(100), types.NativeDenomination), }) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: testing.Alice.Signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: testing.Alice.Signer.Public()}}, nonce) stx := tx.PrepareForSigning() stx.AppendSign(chainCtx, testing.Alice.Signer) @@ -431,7 +431,7 @@ func KVDaveTest(log *logging.Logger, conn *grpc.ClientConn, rtc client.RuntimeCl To: testing.Alice.Address, Amount: types.NewBaseUnits(*quantity.NewFromUint64(10), types.NativeDenomination), }) - tx.AppendSignerInfo(types.AddressSpec{Solo: &types.PublicKey{PublicKey: testing.Dave.Signer.Public()}}, nonce) + tx.AppendSignerInfo(types.AddressSpec{Signature: &types.PublicKey{PublicKey: testing.Dave.Signer.Public()}}, nonce) stx := tx.PrepareForSigning() stx.AppendSign(chainCtx, testing.Dave.Signer)