This repository has been archived by the owner on Jan 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Audit validators and web-monitor (#602)
* Web monitor: fixes cache initialization * web monitor: Moves autopay amount format to the server side. Removes previous amount from autopay table. Display description for each payment type. * Web monitor: adds audit view Adds operator account info to the dash view Adds 2 operator check health Adds autopay info to the validator modal Highlights owner's validator in the validators table * Web monitor: adds user defined watch list * Adds autopay watch list as a tab with more stats * Web monitor: adds notes dictionary to watch list * Adds autopay summary and some style fixes * Apply account note to autopay instructions * Fixes tables horizontal scroll for mobile view * Fixes nav text align for mobile view * Adds Audit smart contract WIP * Fixes onboarding_reconfig test
- Loading branch information
Showing
102 changed files
with
6,427 additions
and
2,027 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
language/move-lang/functional-tests/tests/0L/audit/audit_check_autopay_disabled.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! account: alice, 1000000, 0, validator | ||
// Test audit function val_audit_passing having autopay disabled | ||
//! new-transaction | ||
//! sender: libraroot | ||
//! execute-as: alice | ||
script { | ||
use 0x1::Audit; | ||
use 0x1::ValidatorConfig; | ||
use 0x1::AutoPay2; | ||
use 0x1::MinerState; | ||
use 0x1::GAS::GAS; | ||
use 0x1::LibraAccount; | ||
|
||
fun main(lr: &signer, alice_account: &signer) { | ||
assert(ValidatorConfig::is_valid({{alice}}), 7357007001001); | ||
|
||
// transfer enough coins to operator | ||
AutoPay2::enable_autopay(alice_account); | ||
let oper = ValidatorConfig::get_operator({{alice}}); | ||
LibraAccount::vm_make_payment_no_limit<GAS>( | ||
{{alice}}, | ||
oper, // has a 0 in balance | ||
50009, | ||
x"", | ||
x"", | ||
lr | ||
); | ||
assert(LibraAccount::balance<GAS>(oper) == 50009, 7357007001002); | ||
AutoPay2::disable_autopay(alice_account); | ||
|
||
assert(!AutoPay2::is_enabled({{alice}}), 7357007001003); | ||
assert(MinerState::is_init({{alice}}), 7357007001004); | ||
assert(!Audit::val_audit_passing({{alice}}), 7357007001005); | ||
} | ||
} | ||
// check: EXECUTED |
42 changes: 42 additions & 0 deletions
42
language/move-lang/functional-tests/tests/0L/audit/audit_check_operator_balance.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! account: alice, 1000000, 0, validator | ||
// Test audit function val_audit_passing having not enough balance | ||
//! new-transaction | ||
//! sender: libraroot | ||
//! execute-as: alice | ||
script { | ||
use 0x1::Audit; | ||
// use 0x1::Signer; | ||
use 0x1::ValidatorConfig; | ||
use 0x1::AutoPay2; | ||
use 0x1::MinerState; | ||
use 0x1::GAS::GAS; | ||
use 0x1::LibraAccount; | ||
|
||
fun main(lr: &signer, alice_account: &signer) { | ||
// enable autopay | ||
AutoPay2::enable_autopay(alice_account); | ||
assert(AutoPay2::is_enabled({{alice}}), 7357007002001); | ||
assert(ValidatorConfig::is_valid({{alice}}), 7357007002002); | ||
assert(MinerState::is_init({{alice}}), 7357007002003); | ||
|
||
// check operator zero balance | ||
let oper = ValidatorConfig::get_operator({{alice}}); | ||
assert(LibraAccount::balance<GAS>(oper) == 0, 7357007002004); | ||
assert(!Audit::val_audit_passing({{alice}}), 7357007002005); | ||
|
||
// transfer not enough balance to operator | ||
let oper = ValidatorConfig::get_operator({{alice}}); | ||
LibraAccount::vm_make_payment_no_limit<GAS>( | ||
{{alice}}, | ||
oper, | ||
49999, | ||
x"", | ||
x"", | ||
lr | ||
); | ||
assert(LibraAccount::balance<GAS>(oper) == 49999, 7357007002006); | ||
assert(!Audit::val_audit_passing({{alice}}), 7357007002007); | ||
} | ||
} | ||
// check: EXECUTED |
42 changes: 42 additions & 0 deletions
42
language/move-lang/functional-tests/tests/0L/audit/audit_passing_happy_day.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//! account: alice, 1000000, 0, validator | ||
// Test audit function val_audit_passing satisfying all conditions | ||
//! new-transaction | ||
//! sender: libraroot | ||
//! execute-as: alice | ||
script { | ||
use 0x1::Audit; | ||
// use 0x1::Signer; | ||
use 0x1::ValidatorConfig; | ||
use 0x1::AutoPay2; | ||
use 0x1::MinerState; | ||
use 0x1::GAS::GAS; | ||
use 0x1::LibraAccount; | ||
|
||
fun main(lr: &signer, alice_account: &signer) { | ||
assert(ValidatorConfig::is_valid({{alice}}), 7357007003001); | ||
|
||
// transfer enough coins to operator | ||
let oper = ValidatorConfig::get_operator({{alice}}); | ||
LibraAccount::vm_make_payment_no_limit<GAS>( | ||
{{alice}}, | ||
oper, // has a 0 in balance | ||
50009, | ||
x"", | ||
x"", | ||
lr | ||
); | ||
assert(LibraAccount::balance<GAS>(oper) == 50009, 7357007003002); | ||
|
||
// enable autopay | ||
assert(!AutoPay2::is_enabled({{alice}}), 7357007003003); | ||
AutoPay2::enable_autopay(alice_account); | ||
assert(AutoPay2::is_enabled({{alice}}), 7357007003004); | ||
|
||
assert(MinerState::is_init({{alice}}), 7357007003005); | ||
|
||
// audit must pass | ||
assert(Audit::val_audit_passing({{alice}}), 7357007003006); | ||
} | ||
} | ||
// check: EXECUTED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.