Skip to content

Commit

Permalink
GH-1523 Use raw Affine LE form
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Sep 7, 2023
1 parent 77a1935 commit 3a4d5ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libraries/chain/webassembly/privileged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ namespace eosio { namespace chain { namespace webassembly {
EOS_ASSERT( f.description.size() <= config::max_finalizer_description_size, wasm_execution_error,
"Finalizer description greater than ${s}", ("s", config::max_finalizer_description_size) );
f_weight_sum += f.fweight;
std::optional<bls12_381::g1> pk = bls12_381::g1::fromAffineBytesLE(f.public_key_g1_affine_le);
constexpr bool check = false; // system contract does proof of possession check which is a stronger check
constexpr bool raw = true;
std::optional<bls12_381::g1> pk = bls12_381::g1::fromAffineBytesLE(f.public_key_g1_affine_le, check, raw);
EOS_ASSERT( pk, wasm_execution_error, "Invalid public key for: ${d}", ("d", f.description) );
finset.finalizers.push_back(finalizer_authority{.description = std::move(f.description),
.fweight = f.fweight,
.public_key{fc::crypto::blslib::bls_public_key{*pk}}});
unique_finalizer_keys.insert(*pk);
}

// system contract should perform a duplicate check and fthreshold check before calling
EOS_ASSERT( finalizers.size() == unique_finalizer_keys.size(), wasm_execution_error, "Duplicate finalizer bls key in finalizer set" );
EOS_ASSERT( finset.fthreshold > f_weight_sum / 2, wasm_execution_error, "Finalizer set threshold cannot be met by finalizer weights" );

Expand Down

0 comments on commit 3a4d5ad

Please sign in to comment.