This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref #2: Check transaction carries expected signatures
All transactions must declare a list of permissions they utilize. The chain now checks that the signatures are present to satisfy these permissions, at least theoretically (only partially tested). As the transaction is evaluated and applied, the message handlers will check that the required permissions were declared on the transaction. Also, define the logic to check that an authority is satisfied (only this part is tested so far) TODO: Test that transactions are rejected if they do not bear sufficient signatures TODO: Make message handlers check the declared permissions are sufficient, and reject the transaction if they are not.
- Loading branch information
1 parent
330185e
commit 15898a0
Showing
9 changed files
with
250 additions
and
115 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2017, Respective Authors. | ||
* | ||
* The MIT License | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
#pragma once | ||
#include <eos/chain/authority.hpp> | ||
|
||
#include "multi_index_includes.hpp" | ||
|
||
namespace eos { namespace chain { | ||
class permission_object : public chainbase::object<permission_object_type, permission_object> { | ||
OBJECT_CTOR(permission_object, (auth) ) | ||
|
||
id_type id; | ||
AccountName owner; ///< the account this permission belongs to | ||
id_type parent; ///< parent permission | ||
PermissionName name; ///< human-readable name for the permission | ||
shared_authority auth; ///< authority required to execute this permission | ||
}; | ||
|
||
struct by_parent; | ||
struct by_owner; | ||
struct by_name; | ||
using permission_index = chainbase::shared_multi_index_container< | ||
permission_object, | ||
indexed_by< | ||
ordered_unique<tag<by_id>, member<permission_object, permission_object::id_type, &permission_object::id>>, | ||
ordered_unique<tag<by_parent>, | ||
composite_key<permission_object, | ||
member<permission_object, permission_object::id_type, &permission_object::parent>, | ||
member<permission_object, permission_object::id_type, &permission_object::id> | ||
> | ||
>, | ||
ordered_unique<tag<by_owner>, | ||
composite_key<permission_object, | ||
member<permission_object, AccountName, &permission_object::owner>, | ||
member<permission_object, PermissionName, &permission_object::name> | ||
> | ||
>, | ||
ordered_unique<tag<by_name>, | ||
composite_key<permission_object, | ||
member<permission_object, PermissionName, &permission_object::name>, | ||
member<permission_object, permission_object::id_type, &permission_object::id> | ||
> | ||
> | ||
> | ||
>; | ||
|
||
} } // eos::chain | ||
|
||
CHAINBASE_SET_INDEX_TYPE(eos::chain::permission_object, eos::chain::permission_index) | ||
|
||
FC_REFLECT(chainbase::oid<eos::chain::permission_object>, (_id)) | ||
FC_REFLECT(eos::chain::permission_object, (id)(owner)(parent)(name)(auth)) |
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.