Skip to content

Commit fa8ee00

Browse files
committed
adopt AIP-61 terminology for consistency (#12123)
adopt AIP-61 terminology for consistency
1 parent 0d29ccd commit fa8ee00

File tree

47 files changed

+1129
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1129
-1127
lines changed

api/doc/spec.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13433,7 +13433,7 @@
1343313433
"ed25519": "#/components/schemas/PublicKey_string(HexEncodedBytes)",
1343413434
"secp256k1_ecdsa": "#/components/schemas/PublicKey_string(HexEncodedBytes)",
1343513435
"secp256r1_ecdsa": "#/components/schemas/PublicKey_string(HexEncodedBytes)",
13436-
"zk_id": "#/components/schemas/PublicKey_string(HexEncodedBytes)"
13436+
"oidb": "#/components/schemas/PublicKey_string(HexEncodedBytes)"
1343713437
}
1343813438
}
1343913439
},
@@ -13447,7 +13447,7 @@
1344713447
"properties": {
1344813448
"type": {
1344913449
"type": "string",
13450-
"example": "zk_id"
13450+
"example": "oidb"
1345113451
}
1345213452
}
1345313453
},
@@ -13538,7 +13538,7 @@
1353813538
"ed25519": "#/components/schemas/Signature_string(HexEncodedBytes)",
1353913539
"secp256k1_ecdsa": "#/components/schemas/Signature_string(HexEncodedBytes)",
1354013540
"web_authn": "#/components/schemas/Signature_string(HexEncodedBytes)",
13541-
"zk_id": "#/components/schemas/Signature_string(HexEncodedBytes)"
13541+
"oidb": "#/components/schemas/Signature_string(HexEncodedBytes)"
1354213542
}
1354313543
}
1354413544
},
@@ -13552,7 +13552,7 @@
1355213552
"properties": {
1355313553
"type": {
1355413554
"type": "string",
13555-
"example": "zk_id"
13555+
"example": "oidb"
1355613556
}
1355713557
}
1355813558
},

api/doc/spec.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10115,7 +10115,7 @@ components:
1011510115
ed25519: '#/components/schemas/PublicKey_string(HexEncodedBytes)'
1011610116
secp256k1_ecdsa: '#/components/schemas/PublicKey_string(HexEncodedBytes)'
1011710117
secp256r1_ecdsa: '#/components/schemas/PublicKey_string(HexEncodedBytes)'
10118-
zk_id: '#/components/schemas/PublicKey_string(HexEncodedBytes)'
10118+
oidb: '#/components/schemas/PublicKey_string(HexEncodedBytes)'
1011910119
PublicKey_string(HexEncodedBytes):
1012010120
allOf:
1012110121
- type: object
@@ -10124,7 +10124,7 @@ components:
1012410124
properties:
1012510125
type:
1012610126
type: string
10127-
example: zk_id
10127+
example: oidb
1012810128
- $ref: '#/components/schemas/HexEncodedBytes'
1012910129
RawTableItemRequest:
1013010130
type: object
@@ -10181,7 +10181,7 @@ components:
1018110181
ed25519: '#/components/schemas/Signature_string(HexEncodedBytes)'
1018210182
secp256k1_ecdsa: '#/components/schemas/Signature_string(HexEncodedBytes)'
1018310183
web_authn: '#/components/schemas/Signature_string(HexEncodedBytes)'
10184-
zk_id: '#/components/schemas/Signature_string(HexEncodedBytes)'
10184+
oidb: '#/components/schemas/Signature_string(HexEncodedBytes)'
1018510185
Signature_string(HexEncodedBytes):
1018610186
allOf:
1018710187
- type: object
@@ -10190,7 +10190,7 @@ components:
1019010190
properties:
1019110191
type:
1019210192
type: string
10193-
example: zk_id
10193+
example: oidb
1019410194
- $ref: '#/components/schemas/HexEncodedBytes'
1019510195
SingleKeySignature:
1019610196
type: object

api/src/tests/accounts_test.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ async fn test_get_account_resources_with_pagination() {
237237
{
238238
println!("0x1::{}::{}", r.module, r.name);
239239
}
240-
assert_eq!(resources.len(), 5);
241-
assert_eq!(resources, all_resources[0..5].to_vec());
240+
assert_eq!(resources.len(), 4);
241+
assert_eq!(resources, all_resources[0..4].to_vec());
242242

243243
// Make a request using the cursor. Assert the 5 results we get back are the next 5.
244244
let req = warp::test::request().method("GET").path(&format!(
@@ -255,7 +255,7 @@ async fn test_get_account_resources_with_pagination() {
255255
let cursor_header = StateKeyWrapper::from_str(cursor_header.to_str().unwrap()).unwrap();
256256
let resources: Vec<MoveResource> = serde_json::from_slice(resp.body()).unwrap();
257257
assert_eq!(resources.len(), 5);
258-
assert_eq!(resources, all_resources[5..10].to_vec());
258+
assert_eq!(resources, all_resources[4..9].to_vec());
259259

260260
// Get the rest of the resources, assert there is no cursor now.
261261
let req = warp::test::request().method("GET").path(&format!(
@@ -267,8 +267,8 @@ async fn test_get_account_resources_with_pagination() {
267267
assert_eq!(resp.status(), 200);
268268
assert!(!resp.headers().contains_key("X-Aptos-Cursor"));
269269
let resources: Vec<MoveResource> = serde_json::from_slice(resp.body()).unwrap();
270-
assert_eq!(resources.len(), all_resources.len() - 10);
271-
assert_eq!(resources, all_resources[10..].to_vec());
270+
assert_eq!(resources.len(), all_resources.len() - 9);
271+
assert_eq!(resources, all_resources[9..].to_vec());
272272
}
273273

274274
// Same as the above test but for modules.

api/types/src/transaction.rs

+28-28
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use aptos_types::{
2020
block_metadata::BlockMetadata,
2121
block_metadata_ext::BlockMetadataExt,
2222
contract_event::{ContractEvent, EventWithVersion},
23+
oidb,
2324
transaction::{
2425
authenticator::{
2526
AccountAuthenticator, AnyPublicKey, AnySignature, MultiKey, MultiKeyAuthenticator,
@@ -28,7 +29,6 @@ use aptos_types::{
2829
webauthn::{PartialAuthenticatorAssertionResponse, MAX_WEBAUTHN_SIGNATURE_BYTES},
2930
Script, SignedTransaction, TransactionOutput, TransactionWithProof,
3031
},
31-
zkid,
3232
};
3333
use once_cell::sync::Lazy;
3434
use poem_openapi::{Object, Union};
@@ -1198,24 +1198,24 @@ impl VerifyInput for WebAuthnSignature {
11981198
}
11991199

12001200
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Object)]
1201-
pub struct ZkIdSignature {
1201+
pub struct OidbSignature {
12021202
pub public_key: HexEncodedBytes,
12031203
pub signature: HexEncodedBytes,
12041204
}
12051205

1206-
impl VerifyInput for ZkIdSignature {
1206+
impl VerifyInput for OidbSignature {
12071207
fn verify(&self) -> anyhow::Result<()> {
12081208
let public_key_len = self.public_key.inner().len();
12091209
let signature_len = self.signature.inner().len();
1210-
if public_key_len > zkid::ZkIdPublicKey::MAX_LEN {
1210+
if public_key_len > oidb::OidbPublicKey::MAX_LEN {
12111211
bail!(
1212-
"zkID public key length is greater than the maximum number of {} bytes: found {} bytes",
1213-
zkid::ZkIdPublicKey::MAX_LEN, public_key_len
1212+
"OIDB public key length is greater than the maximum number of {} bytes: found {} bytes",
1213+
oidb::OidbPublicKey::MAX_LEN, public_key_len
12141214
)
1215-
} else if signature_len > zkid::ZkIdSignature::MAX_LEN {
1215+
} else if signature_len > oidb::OidbSignature::MAX_LEN {
12161216
bail!(
1217-
"zkID signature length is greater than the maximum number of {} bytes: found {} bytes",
1218-
zkid::ZkIdSignature::MAX_LEN, signature_len
1217+
"OIDB signature length is greater than the maximum number of {} bytes: found {} bytes",
1218+
oidb::OidbSignature::MAX_LEN, signature_len
12191219
)
12201220
} else {
12211221
Ok(())
@@ -1230,7 +1230,7 @@ pub enum Signature {
12301230
Ed25519(HexEncodedBytes),
12311231
Secp256k1Ecdsa(HexEncodedBytes),
12321232
WebAuthn(HexEncodedBytes),
1233-
ZkId(HexEncodedBytes),
1233+
Oidb(HexEncodedBytes),
12341234
}
12351235

12361236
impl TryFrom<Signature> for AnySignature {
@@ -1241,7 +1241,7 @@ impl TryFrom<Signature> for AnySignature {
12411241
Signature::Ed25519(s) => AnySignature::ed25519(s.inner().try_into()?),
12421242
Signature::Secp256k1Ecdsa(s) => AnySignature::secp256k1_ecdsa(s.inner().try_into()?),
12431243
Signature::WebAuthn(s) => AnySignature::webauthn(s.inner().try_into()?),
1244-
Signature::ZkId(s) => AnySignature::zkid(s.inner().try_into()?),
1244+
Signature::Oidb(s) => AnySignature::oidb(s.inner().try_into()?),
12451245
})
12461246
}
12471247
}
@@ -1258,7 +1258,7 @@ impl From<AnySignature> for Signature {
12581258
AnySignature::WebAuthn { signature } => {
12591259
Signature::WebAuthn(signature.to_bytes().to_vec().into())
12601260
},
1261-
AnySignature::ZkId { signature } => Signature::ZkId(signature.to_bytes().into()),
1261+
AnySignature::OIDB { signature } => Signature::Oidb(signature.to_bytes().into()),
12621262
}
12631263
}
12641264
}
@@ -1270,7 +1270,7 @@ pub enum PublicKey {
12701270
Ed25519(HexEncodedBytes),
12711271
Secp256k1Ecdsa(HexEncodedBytes),
12721272
Secp256r1Ecdsa(HexEncodedBytes),
1273-
ZkId(HexEncodedBytes),
1273+
Oidb(HexEncodedBytes),
12741274
}
12751275

12761276
impl TryFrom<PublicKey> for AnyPublicKey {
@@ -1281,7 +1281,7 @@ impl TryFrom<PublicKey> for AnyPublicKey {
12811281
PublicKey::Ed25519(p) => AnyPublicKey::ed25519(p.inner().try_into()?),
12821282
PublicKey::Secp256k1Ecdsa(p) => AnyPublicKey::secp256k1_ecdsa(p.inner().try_into()?),
12831283
PublicKey::Secp256r1Ecdsa(p) => AnyPublicKey::secp256r1_ecdsa(p.inner().try_into()?),
1284-
PublicKey::ZkId(p) => AnyPublicKey::zkid(p.inner().try_into()?),
1284+
PublicKey::Oidb(p) => AnyPublicKey::oidb(p.inner().try_into()?),
12851285
})
12861286
}
12871287
}
@@ -1298,7 +1298,7 @@ impl From<AnyPublicKey> for PublicKey {
12981298
AnyPublicKey::Secp256r1Ecdsa { public_key } => {
12991299
PublicKey::Secp256r1Ecdsa(public_key.to_bytes().to_vec().into())
13001300
},
1301-
AnyPublicKey::ZkId { public_key } => PublicKey::ZkId(public_key.to_bytes().into()),
1301+
AnyPublicKey::OIDB { public_key } => PublicKey::Oidb(public_key.to_bytes().into()),
13021302
}
13031303
}
13041304
}
@@ -1330,7 +1330,7 @@ impl VerifyInput for SingleKeySignature {
13301330
signature: s.clone(),
13311331
}
13321332
.verify(),
1333-
(PublicKey::ZkId(p), Signature::ZkId(s)) => ZkIdSignature {
1333+
(PublicKey::Oidb(p), Signature::Oidb(s)) => OidbSignature {
13341334
public_key: p.clone(),
13351335
signature: s.clone(),
13361336
}
@@ -1374,12 +1374,12 @@ impl TryFrom<SingleKeySignature> for AccountAuthenticator {
13741374
)?;
13751375
AnyPublicKey::secp256r1_ecdsa(key)
13761376
},
1377-
PublicKey::ZkId(p) => {
1377+
PublicKey::Oidb(p) => {
13781378
let key = p
13791379
.inner()
13801380
.try_into()
1381-
.context("Failed to parse given public_key bytes as ZkIdPublicKey")?;
1382-
AnyPublicKey::zkid(key)
1381+
.context("Failed to parse given public_key bytes as OidbPublicKey")?;
1382+
AnyPublicKey::oidb(key)
13831383
},
13841384
};
13851385

@@ -1405,12 +1405,12 @@ impl TryFrom<SingleKeySignature> for AccountAuthenticator {
14051405
.context( "Failed to parse given signature bytes as PartialAuthenticatorAssertionResponse")?;
14061406
AnySignature::webauthn(signature)
14071407
},
1408-
Signature::ZkId(s) => {
1408+
Signature::Oidb(s) => {
14091409
let signature = s
14101410
.inner()
14111411
.try_into()
1412-
.context("Failed to parse given signature bytes as ZkIdSignature")?;
1413-
AnySignature::zkid(signature)
1412+
.context("Failed to parse given signature bytes as OidbSignature")?;
1413+
AnySignature::oidb(signature)
14141414
},
14151415
};
14161416

@@ -1475,12 +1475,12 @@ impl TryFrom<MultiKeySignature> for AccountAuthenticator {
14751475
)?;
14761476
AnyPublicKey::secp256r1_ecdsa(key)
14771477
},
1478-
PublicKey::ZkId(p) => {
1478+
PublicKey::Oidb(p) => {
14791479
let key = p
14801480
.inner()
14811481
.try_into()
1482-
.context("Failed to parse given public_key bytes as ZkIdPublicKey")?;
1483-
AnyPublicKey::zkid(key)
1482+
.context("Failed to parse given public_key bytes as OidbPublicKey")?;
1483+
AnyPublicKey::oidb(key)
14841484
},
14851485
};
14861486
public_keys.push(key);
@@ -1508,12 +1508,12 @@ impl TryFrom<MultiKeySignature> for AccountAuthenticator {
15081508
)?;
15091509
AnySignature::webauthn(paar)
15101510
},
1511-
Signature::ZkId(s) => {
1511+
Signature::Oidb(s) => {
15121512
let signature = s
15131513
.inner()
15141514
.try_into()
1515-
.context("Failed to parse given signature as ZkIdSignature")?;
1516-
AnySignature::zkid(signature)
1515+
.context("Failed to parse given signature as OidbSignature")?;
1516+
AnySignature::oidb(signature)
15171517
},
15181518
};
15191519
signatures.push((indexed_signature.index, signature));

aptos-move/aptos-release-builder/data/release.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ proposals:
151151
- FeatureFlag:
152152
enabled:
153153
- jwk_consensus
154-
- name: step_12_enable_zkid
154+
- name: step_12_enable_oidb
155155
metadata:
156156
title: "AIP-61: OpenID blockchain (OIDB) accounts"
157-
description: "Enable validation of zkID transactions, allowing users to transact using their Web2 accounts"
157+
description: "Enable validation of OIDB transactions, allowing users to transact using their Web2 accounts"
158158
discussion_url: "https://github.com/aptos-foundation/AIPs/issues/297"
159159
execution_mode: MultiStep
160160
update_sequence:
161161
- FeatureFlag:
162162
enabled:
163-
- zk_id_signature
163+
- oidb_signature
164164
- name: step_13_start_watching_google_jwks
165165
metadata:
166166
title: "Start JWK consensus for Google"

aptos-move/aptos-release-builder/src/components/feature_flags.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ pub enum FeatureFlag {
9696
Bn254Structures,
9797
WebAuthnSignature,
9898
ReconfigureWithDkg,
99-
ZkIdSignature,
100-
ZkIdZkLessSignature,
99+
OidbSignature,
100+
OidbZkLessSignature,
101101
RemoveDetailedError,
102102
JwkConsensus,
103103
ConcurrentFungibleAssets,
@@ -257,8 +257,8 @@ impl From<FeatureFlag> for AptosFeatureFlag {
257257
FeatureFlag::Bn254Structures => AptosFeatureFlag::BN254_STRUCTURES,
258258
FeatureFlag::WebAuthnSignature => AptosFeatureFlag::WEBAUTHN_SIGNATURE,
259259
FeatureFlag::ReconfigureWithDkg => AptosFeatureFlag::RECONFIGURE_WITH_DKG,
260-
FeatureFlag::ZkIdSignature => AptosFeatureFlag::ZK_ID_SIGNATURES,
261-
FeatureFlag::ZkIdZkLessSignature => AptosFeatureFlag::ZK_ID_ZKLESS_SIGNATURE,
260+
FeatureFlag::OidbSignature => AptosFeatureFlag::OIDB_SIGNATURE,
261+
FeatureFlag::OidbZkLessSignature => AptosFeatureFlag::OIDB_ZKLESS_SIGNATURE,
262262
FeatureFlag::RemoveDetailedError => AptosFeatureFlag::REMOVE_DETAILED_ERROR_FROM_HASH,
263263
FeatureFlag::JwkConsensus => AptosFeatureFlag::JWK_CONSENSUS,
264264
FeatureFlag::ConcurrentFungibleAssets => AptosFeatureFlag::CONCURRENT_FUNGIBLE_ASSETS,
@@ -341,8 +341,8 @@ impl From<AptosFeatureFlag> for FeatureFlag {
341341
AptosFeatureFlag::BN254_STRUCTURES => FeatureFlag::Bn254Structures,
342342
AptosFeatureFlag::WEBAUTHN_SIGNATURE => FeatureFlag::WebAuthnSignature,
343343
AptosFeatureFlag::RECONFIGURE_WITH_DKG => FeatureFlag::ReconfigureWithDkg,
344-
AptosFeatureFlag::ZK_ID_SIGNATURES => FeatureFlag::ZkIdSignature,
345-
AptosFeatureFlag::ZK_ID_ZKLESS_SIGNATURE => FeatureFlag::ZkIdZkLessSignature,
344+
AptosFeatureFlag::OIDB_SIGNATURE => FeatureFlag::OidbSignature,
345+
AptosFeatureFlag::OIDB_ZKLESS_SIGNATURE => FeatureFlag::OidbZkLessSignature,
346346
AptosFeatureFlag::REMOVE_DETAILED_ERROR_FROM_HASH => FeatureFlag::RemoveDetailedError,
347347
AptosFeatureFlag::JWK_CONSENSUS => FeatureFlag::JwkConsensus,
348348
AptosFeatureFlag::CONCURRENT_FUNGIBLE_ASSETS => FeatureFlag::ConcurrentFungibleAssets,

aptos-move/aptos-vm/src/aptos_vm.rs

+5-24
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ use crate::{
1212
get_max_binary_format_version, AptosMoveResolver, MoveVmExt, RespawnedSession, SessionExt,
1313
SessionId,
1414
},
15+
oidb_validation,
1516
sharded_block_executor::{executor_client::ExecutorClient, ShardedBlockExecutor},
1617
system_module_names::*,
1718
transaction_metadata::TransactionMetadata,
18-
transaction_validation, verifier, zkid_validation, VMExecutor, VMValidator,
19+
transaction_validation, verifier, VMExecutor, VMValidator,
1920
};
2021
use anyhow::{anyhow, Result};
2122
use aptos_block_executor::txn_commit_hook::NoOpTransactionCommitHook;
@@ -1323,29 +1324,9 @@ impl AptosVM {
13231324
));
13241325
}
13251326

1326-
// zkID feature gating
1327-
let authenticators = aptos_types::zkid::get_zkid_authenticators(transaction);
1328-
match &authenticators {
1329-
Ok(authenticators) => {
1330-
for (_, sig) in authenticators {
1331-
if !self.features.is_zkid_enabled()
1332-
&& matches!(sig.sig, ZkpOrOpenIdSig::Groth16Zkp { .. })
1333-
{
1334-
return Err(VMStatus::error(StatusCode::FEATURE_UNDER_GATING, None));
1335-
}
1336-
if (!self.features.is_zkid_enabled() || !self.features.is_zkid_zkless_enabled())
1337-
&& matches!(sig.sig, ZkpOrOpenIdSig::OpenIdSig { .. })
1338-
{
1339-
return Err(VMStatus::error(StatusCode::FEATURE_UNDER_GATING, None));
1340-
}
1341-
}
1342-
},
1343-
Err(_) => {
1344-
return Err(VMStatus::error(StatusCode::INVALID_SIGNATURE, None));
1345-
},
1346-
}
1347-
1348-
zkid_validation::validate_zkid_authenticators(&authenticators.unwrap(), resolver)?;
1327+
let authenticators = aptos_types::oidb::get_oidb_authenticators(transaction)
1328+
.map_err(|_| VMStatus::error(StatusCode::INVALID_SIGNATURE, None))?;
1329+
oidb_validation::validate_oidb_authenticators(&authenticators, self.features(), resolver)?;
13491330

13501331
// The prologue MUST be run AFTER any validation. Otherwise you may run prologue and hit
13511332
// SEQUENCE_NUMBER_TOO_NEW if there is more than one transaction from the same sender and

aptos-move/aptos-vm/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ mod errors;
111111
mod gas;
112112
pub mod move_vm_ext;
113113
pub mod natives;
114+
mod oidb_validation;
114115
pub mod sharded_block_executor;
115116
pub mod system_module_names;
116117
pub mod testing;
117118
pub mod transaction_metadata;
118119
mod transaction_validation;
119120
pub mod validator_txns;
120121
pub mod verifier;
121-
mod zkid_validation;
122122

123123
pub use crate::aptos_vm::{AptosSimulationVM, AptosVM};
124124
use crate::sharded_block_executor::{executor_client::ExecutorClient, ShardedBlockExecutor};

0 commit comments

Comments
 (0)